# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=dbus
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.14.10
pkgrel=1
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
pkgdesc="Freedesktop.org message bus system (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-expat")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-pkgconf"
             "${MINGW_PACKAGE_PREFIX}-python"
             "${MINGW_PACKAGE_PREFIX}-autotools"
             "${MINGW_PACKAGE_PREFIX}-glib2"         
             "autoconf-archive"
             "xmlto")
license=('spdx:AFL-2.1 OR GPL-2.0-or-later')
url="https://www.freedesktop.org/wiki/Software/dbus"
msys2_references=(
  "cpe: cpe:/a:d-bus_project:d-bus"
  "cpe: cpe:/a:freedesktop:dbus"
)
source=("https://dbus.freedesktop.org/releases/dbus/${_realname}-${pkgver}.tar.xz"{,.asc})
sha256sums=('ba1f21d2bd9d339da2d4aa8780c09df32fea87998b73da24f49ab9df1e36a50f'
            'SKIP')
validpgpkeys=('DA98F25C0871C49A59EAFF2C4DE8FF2A63C7CC90')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}

  autoreconf -fiv
}

build() {
  mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

  ../${_realname}-${pkgver}/configure \
    --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --disable-xml-docs \
    --disable-ducktype-docs \
    --disable-systemd \
    --enable-shared \
    --enable-static

  make
}

check() {
  cd "${srcdir}/build-${MSYSTEM}"
  make check || true
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"
  make DESTDIR="${pkgdir}" install
}
